home *** CD-ROM | disk | FTP | other *** search
/ Tech Arsenal 1 / Tech Arsenal (Arsenal Computer).ISO / tek-02 / powrdoor.zip / POWRDOOR.DOC < prev    next >
Text File  |  1991-09-26  |  16KB  |  360 lines

  1.        PowerBBS's PowerDOOR - A Programmers Door Interface to PowerBBS
  2.  
  3.                (c) 1991 by Russell E. Frey; All Rights Reserved
  4.  
  5.                                 35 Fox Ct.
  6.                             Hicksville, NY 11801
  7.  
  8.                           Support Line (516) 822-7396
  9.  
  10. To use PowerDOOR, you will need a copy of Turbo Pascal for Windows (tm).
  11.  
  12. No code produced with PowerDOOR may be sold commercially.  You may produce
  13. doors for your own use, or issue the doors into public domain or shareware.
  14. If you want to produce commercial code, then please contact Russell Frey,
  15. for a prior contract and licensing agreement.
  16.  
  17. Doors produced under the SHAREWARE concept may be distributed, so long
  18. as there are no limitations to the registered version (and must be
  19. shareware as according to the Association of Shareware Professionals).
  20. The registered version should be the same program, with the exception
  21. of a Registered to: line, instead of not-registered.
  22.  
  23. To produce a door with PowerDOOR, the following requirements are held:
  24.  
  25.  1) You must place powrwin and powrdoor in your uses
  26.     statement.
  27.  
  28.  2) You must always begin your program with (begin_live_program(name);) and
  29.     end your program with (end_live_program;)
  30.  
  31. An example program, blackjack, is included in this package (black.pas).  As
  32. with any PowerBBS Live Program, to set up the live door, you will place the
  33. following in your live.dat:
  34.  
  35. c:\wsource\black.exe c:\powrbbs\powrwin.dat,10,
  36.  
  37. All windows live programs must contain the .exe, and path to the data file.
  38.  
  39. A Copy of PowrSYS.PAS is now incuded!  Use to modify, or just to learn
  40. about how PowrDOOR works!
  41.  
  42. If you write a door, or code that you would like to distribute, please
  43. upload your programs to the support bbs (516) 822-7396.  The existence
  44. of programs using PowerDoor, will give me an incentive to continue
  45. supporting the programming community.
  46.  
  47. Feel free to upload modifications to the sample source code to our
  48. bbs.
  49.  
  50. The following procedures/functions/structures are currently available for
  51. your use:
  52.  
  53. --> procedure begin_live_program(name_of_prog: string);
  54. Use to open PowerDOOR.  Name of Prog variable, is the name of your program.
  55.  
  56. --> procedure end_live_program;
  57. Needed to close PowerDoor.
  58.  
  59. --> procedure write_com(msg: string);
  60. Writes a string to the user.  If user is remote, information is sent
  61. to the com port, etc.
  62.  
  63. --> procedure writeln_com(msg: string);
  64. Same as write_com, except a return is entered at the end of output.
  65.  
  66. --> procedure writelncom;
  67. This procedure will return a blank return to the screen.  You could
  68. do the same thing with writeln_com('');
  69.  
  70. --> procedure writeln_com_spaces(numberof: integer);
  71. Sends the specified number of spaces to the com port.
  72.  
  73. --> procedure writeln_com_border(beginx,width_border: integer);
  74. Displays a border (|------------|), starting at the x coordinate
  75. with the given width specified.
  76.  
  77. --> procedure writeln_com_node_status;
  78. Writes the node status screen, with the current callers on-line the
  79. different nodes.
  80.  
  81. --> function infotext(pline: string): string;
  82. Will interpret |MACROS|.  For example, you can do:
  83. writeln_com(infotext('Welcome |NAME|'));
  84.  
  85. --> function drop_carrier: boolean;
  86. If user is not online, then this function is set to TRUE.  You should always
  87. use this in any loop structure, such as:
  88.  Repeat
  89.   delay(50);
  90.  Until (drop_carrier) or (your statements);
  91.  
  92. --> procedure get_a_return;
  93. Tells the user to press return (or enter), and will wait till it is pressed.
  94.  
  95. --> procedure activity(stringtowrite: string);
  96. Writes the information to the activity_log file.
  97.  
  98. --> procedure clearscreen;
  99. Clears the screen, including the users screen, if ANSI is turned on.
  100.  
  101. --> procedure type_file(file: string);
  102. Types a file to the user. If you use type_file('wel'), then the file
  103. wel, will be displayed.  If welc is available, and the user has ANSI
  104. capability, then it will be displayed.  (Notice c for color)
  105.  
  106. --> function user_abort: boolean;
  107. If this function returns TRUE, the user wants to abort.  This function
  108. displays ::Pause:: [S]top, etc.  Use this in the middle of a procedure
  109. which outputs lots of text, that you want the user to be able to abort.
  110. Example:
  111.                 Repeat
  112.                   inc(counter);
  113.                   writeln_text(info[counter]);
  114.                   if user_abort then exit;
  115.                 Until (counter = 100) or (drop_carrier);
  116.  
  117. --> procedure ask_user(input_string: string;
  118.                    max_input_length: integer);
  119. This procedure should be used to get input from the user, such as a
  120. Readln(string), statement.  Notice that max_input_length, is the
  121. maximum length the string input is permitted to be.
  122.  
  123. --> function input_char: char;
  124. This function will receive one character from the user.
  125.  
  126. --> procedure Get_Hotkey(Var Char_Get: Char);
  127. Waits till one character is available, and will return the first carrier
  128. into Char_Get.  Will also return, if carrier drops, etc.
  129.  
  130. --> function get_hotkey_yn: boolean;
  131. This procedure will wait until the keys y or n are pressed.  It will display
  132. Yes or No, and a return after the key has been pressed.
  133. get_hotkey_yn is TRUE if yes is pressed.
  134.  
  135. --> Procedure Get_Date(Var NewDate: String;
  136.                           OK_Default: Boolean;
  137.                           Default: String);
  138. Will ask the user for a date.  If OK_DEFAULT is set to Yes, then when
  139. the user selects only ENTER, the Default will be returned.  Otherwise,
  140. the new date will be entered into NewDate.
  141.  
  142. --> Function GetInput(One_Key: Boolean;
  143.                    Var Answer: String;
  144.                        Max_An: integer): Boolean;
  145. Gets an input from user.  Default [ENTER=Quit].  If Enter is selected,
  146. TRUE is returned.  Otherwise FALSE is returned, with Answer the resulted
  147. input.  Max_An is maximum input size (set to one when One_Key is selected).
  148.  
  149. --> Procedure Get_A_Input(     Format: String;
  150.                           Var NewDate: String;
  151.                            OK_Default: Boolean;
  152.                               Default: String);
  153. This is a more complicated input.  It is used for number type inputs,
  154. (dates, phone numbers, etc).  Format is the format of input (###-###-####,
  155. ##/##/##, etc).  NewDate is where the input will be sent to.  If Ok_Default
  156. is selected, then when the user presses the Enter key, Default will be
  157. sent to NewDate.
  158.  
  159. --> procedure save_userinfo;
  160. This program will save the USERINFO record.  Use this only if you want
  161. to save updated information.
  162.  
  163. --> function search_userrec_for(var searchfor: PowrUser; name: char25): integer;
  164. Searches for the given NAME in user record file. If not found, 0 is returned,
  165. otherwise record number is returned.
  166.  
  167. --> function ljust(source: string; num: integer): string;
  168.     function rjust(source: string; num: integer): string;
  169. Adjusts a string according to the NUM.
  170.  
  171. --> procedure put_chars_into(var sendto;
  172.                              from:  string;
  173.                              total_bytes_to_move: integer);
  174. Moves characters from the from string to the sendto pointer.  This
  175. is useful for char packed array types.
  176.  
  177. --> function asc_to_int(temps: string): integer;
  178. Converts an ascii string to an integer
  179.  
  180. --> function int_to_asc(tempint: integer): string;
  181. Converts an integer to a string
  182.  
  183. --> function double_to_kilobyte(fromd: double): string;
  184. Converts a double type to a kilobyte string.
  185.  
  186. --> procedure real_to_double(fromr: real;
  187.                              var tod: double);
  188. Converts reals to doubles.
  189.  
  190. --> procedure upper_string(var tempstring: string);
  191. Converts all letters to capital in a string
  192.  
  193. --> procedure delete_after_spaces(var tempstring: string);
  194. Removes any spaces at the end of a string
  195.  
  196. --> procedure delete_before_spaces(var tempstring: string);
  197. Removes any spaces at the beginning of a string
  198.  
  199. --> function bit_from_byte(from: byte; bit_value: byte): boolean;
  200. Returns the current bit value
  201.  
  202. --> procedure set_bit_byte(var from: byte; bit_value: byte; to_set_to:boolean);
  203. Sets the specified bit value to to_set_to.
  204.  
  205. --> procedure delay(time_ms: longint);
  206. Delays and yields control, for the specified milliseconds.
  207. Delay(1000) = delay and yield control for 1 full second.
  208. You should enter this if you have a repeat -- until, to yeild control
  209. to other applications.
  210.  
  211. --> function SENDRED:     string;  Sends ANSI foreground RED
  212. --> function SENDGREEN:   string;  Sends ANSI foreground GREEN
  213. --> function SENDYELLOW:  string;  Sends ANSI foreground YELLOW
  214. --> function SENDBLUE:    string;  Sends ANSI foreground BLUE
  215. --> function SENDMAGENTA: string;  Sends ANSI foreground MAGENTA
  216. --> function SENDCYAN:    string;  Sends ANSI foreground CYAN
  217. --> function SENDWHITE:   string;  Sends ANSI foreground WHITE
  218. --> function SENDGRAY:    string;  Sends ANSI foreground GRAY
  219. --> function SENDBrown:   string;  Sends ANSI foreground BROWN
  220. --> function SENDBLUEBACK:string;  Sends ANSI background BLUE
  221. --> function SENDRedback: string;  Sends ANSI background RED
  222. --> function SENDPUPback: string;  Sends ANSI background PURPLE
  223.  
  224. File I/O Routines in PowerDOOR
  225.  
  226. var
  227.  file_handle: integer;  (* Given File Handle by operating system *)
  228.  
  229. --> function open_file(name: string;
  230.                        open_method: integer): file_handle;
  231. Opens a file.
  232. Method integer should be either 0,1, or 2, where:
  233. 0 = Open to read a file
  234. 1 = Open to write a file
  235. 2 = Open to read and write a file
  236. Example: AUTO_Handle := Open_file('C:\Autoexec.bat',2);
  237.  
  238. --> function read_file(the_handle: file_handle;
  239.                        var buffer;
  240.                        number_bytes: word): word;
  241. Reads from an opened file.
  242. Returns the number of bytes actually read.
  243. Example: Bytes_Read := Read_File(AUTO_Handle,receive,10);
  244.  
  245. --> function write_file(the_handle: file_handle;
  246.                         var buffer;
  247.                         number_bytes: word): word;
  248. Writes to an opened file.
  249. Returns the number of bytes actually written.
  250. Example: Bytes_Written := Write_File(AUTO_Handle,'Write This',10);
  251.  
  252. --> function seek_file(the_handle: file_handle;
  253.                        seek_to:    longint;
  254.                        seek_type:  integer): longint;
  255. Seeks to the specified position in a file.  It calls the Windows API
  256. (you could actually use the API directly).
  257. Seek_type: 0 - Seek from start of file
  258.            1 - Seek from current position in file
  259.            2 - Seek from end of file
  260.  
  261. --> procedure close_file(the_handle: file_handle);
  262. Closes the file.
  263.  
  264. --> function file_exists(name: string): boolean;
  265. Checks to see if a file exists.  If the file exists, TRUE is returned,
  266. otherwise FALSE is returned.
  267.  
  268. The following record is available, via the USERINFO. declaration.
  269. For example, USERINFO.NAME would be the current Users Name.
  270.  
  271. Type Forum_Type = Record
  272.      Options:  Byte;      {Forum Options:
  273.                            Bit0: Access No/Yes
  274.                            Bit1: Scan No/Yes}
  275.      Lastread: Single;    {Last message read pointer}
  276.     End;
  277.  
  278. Type PowrUser = Record    {Format of the USER database}
  279.        Name:  Packed Array[1..25] Of Char;        {User Name}
  280.        Location:  Packed Array[1..20] Of Char;    {User Location}
  281.        Computer:  Packed Array[1..15] Of Char;    {User Computer Type}
  282.        Phone_Number: Packed Array[1..14] Of Char; {User Phone Number}
  283.        Password:  Packed Array[1..10] Of Char;    {User Password}
  284.        Birthday:  DateType;                       {date of birth}
  285.        First_Call: DateType;                      {date of first logon}
  286.        Last_File_Scan: DateType;                  {date of last NEW scan}
  287.        Expiration_Date: DateType;                 {date subscription ends}
  288.        Last_Call: DateType;                       {date of last logoff}
  289.        Last_Time: TimeType;                       {time of last logoff}
  290.        Calls: Integer;                            {total number of calls}
  291.        Uploads: Integer;                          {number of uploads}
  292.        Downloads: Integer;                        {number of downloads}
  293.        Time_on: Integer;                          {time on today}
  294.        Today_bytes: Double;                       {bytes downloaded today}
  295.        Download_Bytes: Double;                    {bytes downloaded}
  296.        Uploads_Bytes: Double;                     {bytes uploaded}
  297.        Forum_Data:  Array[0..200] Of Forum_Type;
  298.        Access: Byte;                              {access level}
  299.        Expiration_Access: Byte;                   {access after expiration
  300.                                                         date}
  301.        Screen_lines: Byte;                        {number of lines to a screen}
  302.        Safe_Total: Byte;                          {total minutes in safe}
  303.        Options: Byte;                             {options:
  304.                                                     bit0: Expert On/Off
  305.                                                     bit1: Hotkey On/Off
  306.                                                     bit2: Bad User On/Off}
  307.        Xproto: Char;                              {default file xfer protocol}
  308.        Monitor_Type: Char;                        {type of monitor:
  309.                                                     'C' => Color
  310.                                                     'M' => Monochrome
  311.                                                     'N' => None}
  312.        Messages_Left: Word;                       {Number of messages left}
  313.        Reserved: Array[1..200] of byte;
  314.       End;
  315.  
  316. The following record, can be interfaced by using the CALLINFO record.
  317. For example, the name is CALLINFO.NAME
  318.  
  319. Type Powr_CallInfo = Record  {Format of Callers Info File For Live Programs}
  320.        Name:  Packed Array[1..25] Of Char;     {User Name}
  321.        User_Pointer: Integer;                  {User Record # starting at 1}
  322.        BaudRate: Packed Array[1..5] Of Char;   {Baud rate to send at}
  323.        Scomport: Char;                         {Com Number to send at}
  324.        What_Menu: byte;                        {Current Menu}
  325.        Graphics: Char;                         {Graphics Type:
  326.                                                  'C' => Color
  327.                                                  'M' => Monochrome
  328.                                                  'N' => None}
  329.        Access: Byte;                           {User Access Level}
  330.        ForumNum: Byte;                         {Current Forum Number}
  331.        Logon_Time: TimeType;                   {time of logon}
  332.        Logon_Mins: Integer;                    {time the user logged on in mins}
  333.        Used_today: integer;                    {time the user used in
  334.                                                 previous calls so far today}
  335.        Time_Limit: integer;                    {Maximum mins permitted on bbs}
  336.        Kdownload_Maximum: Integer;             {Maximum download bytes in K}
  337.        Upload_Credit: Integer;                 {Minutes given for Uploading}
  338.        Minutes_Useable: Integer;               {Maximum Time left for caller}
  339.        Node_Num: Byte;                  {The node number of this callinfo file}
  340.        Path_Data: string[30];           {path to powrwin.dat}
  341.        Reserved1: Array[1..2] Of Char;
  342.        Reserved2: Byte;
  343.        Reserved3: Longint;
  344.       End;
  345.  
  346. Reserved
  347. --------
  348.  
  349. Some of the reserved variables are used internally by PowerBBS, so
  350. DO NOT touch the reserved variables.
  351.  
  352. Global Variables
  353. ----------------
  354.  
  355. CallerLog --------> Path to the caller activity log file
  356.  
  357. UserFile_Path ----> Path to the users database file
  358.  
  359. Max_Forums -------> Maximum number of forums
  360.